import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/orderPageList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const getDetailById = (id) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/getDetailById',
    method: 'get',
    params: {
      id
    }
  })
}

export const shopOrderStatistics = (params) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/shopOrderStatistics',
    method: 'get',
    params: {
      ...params
    }
  })
}


export const remove = (ids) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/save',
    method: 'post',
    data: row
  })
}


export const update = (row) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/submit',
    method: 'post',
    data: row
  })
}

//收货
export const orderShipments = (row) => {
  return request({
    url: '/api/rb-oem/oem/shopOrder/shop_order/orderShipments',
    method: 'post',
    data: row
  })
}
// 导出订单详细数据
export const exportOrderDetail = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/shopOrder/shop_order/exportOrderDetail',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//导出未发货表单
export const batchShipmentExport = () => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/shopOrder/shop_order/batchShipmentExport',
    method: 'get',

  })
}

//导入表单
export const batchShipmentExcelImport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/shopOrder/shop_order/batchShipmentExcelImport',
    method: 'post',
    params: {
      ...params,
    }

  })
}
